import Vue from "vue";
import store from "@/store";
const hasPermission = permission => {
  return permission.indexOf(store.state.UserInfo.role_en) > -1;
};

Vue.directive("permission", {
  inserted: function(el, binding) {
    const { value } = binding;
    if (!hasPermission(value)) {
      el.parentElement.remove();
    }
    store.state.UserInfo;
  }
});
